/**
 * 报表设计公司(2011)
 */
package com.reportgear.report.view.grid.editor.impl;

import java.awt.Component;

import com.reportgear.core.swing.pane.base.JBaseDialog;
import com.reportgear.report.model.cell.Cell;
import com.reportgear.report.model.cell.value.salary.SalaryFormulaObject;
import com.reportgear.report.view.grid.Grid;
import com.reportgear.report.view.grid.editor.AbstractCellEditor;

/**
 * 工资定制单元格编辑器
 * 
 * @version 1.0 2011-3-26
 * @author <a herf="lexloo@gmail.com">lexloo</a>
 * @since ANNCSR 2.0
 */
public class SalaryFormulaObjectEditor extends AbstractCellEditor {
	private SalaryFormulaObject value;

	@Override
	public Component getCellEditorComponent(Grid grid, Cell cell) {
		SalaryFormulaObjectEditPane editorPane = new SalaryFormulaObjectEditPane();

		editorPane.populate((SalaryFormulaObject) cell.getValue());

		if (editorPane.showDialog(grid) == JBaseDialog.RESULT_OK) {
			this.value = editorPane.update();
		}

		return null;
	}

	@Override
	public Object getCellEditorValue() {
		return this.value;
	}
}
